<?php 

/**
* 控制器基类
*/
class Controller 
{
	public $vars=array();
	public function display($xbsname='')
	{

		// extract($this->vars);

		if (empty($xbsname)) {
			$path =  VIEW_PATH.CONTROLLER_NAME.'/'.ACTION_NAME.'.html';
		}else{
			$path =  VIEW_PATH.CONTROLLER_NAME.'/'.$xbsname.'.html';
		}

		$smarty = new Smarty;

		//$smarty->force_compile = true;
		// $smarty->debugging = true;

		$smarty->setCacheDir('./App/Runtime/cache');// — 设置缓存目录
		$smarty->setCompileDir('./App/Runtime/Compile');// — 设置编译目录
		$smarty->caching = false;
		$smarty->cache_lifetime = 120;

		foreach ($this->vars as $key => $value) {
			$smarty->assign($key, $value);
		}
		
		// $smarty->registerPlugin("function","F", "smarty_f");

		// $smarty->registerPlugin("block","userlist", "Smarty_userlist");

		// $smarty->registerPlugin("modifier","CT", "Smarty_CT");


		$smarty->display($path);

		// include $path;
		
	}

	//分配变量
	public function assgin($name,$value)
	{
		$this->vars[$name]=$value;
	}

	public function __call($name,$value){
		throw new Exception($name."该方法不存在", 1);
	}
	
}















 ?>